#ifndef UMSP_PROTOCOL
#define UMSP_PROTOCOL
#pragma pack(1)

#include <string.h>
#define CMD_C_G_USERULOGIN 2501
#define CMD_C_G_HEARTBEAT 2502
#define CMD_C_G_MSG 2503
#define CMD_G_C_USERMSG 2506
#define CMD_C_G_USERMSG  2507
#define CMD_G_C_ULOGINSUCCESS 2508

#define UMSP_HEADERSIZE sizeof(UMSPHeader)

typedef struct UMSPHeader
{
    int size;
    int version;
    int seq;
    int event;
    int code;
    int cmd;

    UMSPHeader(){
        memset(this, 0, sizeof(UMSPHeader));
    }
}UMSPHeader;

typedef struct UMSPLogin
{
    UMSPHeader header;
    int userID;
    char sign[32];
    UMSPLogin() {
        memset(this, 0, sizeof(UMSPLogin));
        header.cmd = CMD_C_G_USERULOGIN;
        header.size = sizeof(UMSPLogin);
    }
}UMSPULOGin;

typedef struct UMSPHeartBeat
{
    UMSPHeader header;
    UMSPHeartBeat() {
        memset(this, 0, sizeof(UMSPHeartBeat));
        header.cmd = CMD_C_G_HEARTBEAT;
        header.size = sizeof(UMSPHeartBeat);
    }
}UMSPHeartBeat;
typedef struct UMSPMessage
{
    UMSPHeader header;
    char buf[0];
    UMSPMessage() {
        memset(this, 0, sizeof(UMSPMessage));
        header.cmd = CMD_C_G_MSG;
        header.size = sizeof(UMSPMessage);
    }
}UMSPMessage;
#pragma pack(pop)
#endif //UMSP_PROTOCOL